<template>
  <div class="UserInformationZSYPZ">
    <div class="pubBig keQu">
      <div class="h0">
        <p class="lt"></p>
      </div>
      <div class="m0">
        <div class="form-group">

        </div>
      </div>
      <div
        class="mContent cardPD"
        style="overflow: auto;height: 58rem"
      >

        <el-card class="box-card">
          <div
            slot="header"
            class="clearfix"
          >
            <span>模糊合并条件</span>

            <button
              style="float: right;"
              v-if="false"
              type="button"
              class="btn btn-primary"
              @click="addData()"
            >保存
            </button>

          </div>

          <div class="pucLabel">

            <el-card class="box-card cardItem">
              <div
                slot="header"
                class="clearfix"
              >
                <span style="color: #1d6cc3">基本信息：</span>
              </div>

              <div class="pucLabel">
                <el-checkbox
                  v-model="checkedXM"
                  @change=" getItemNameCol('姓名')"
                >姓名</el-checkbox>
                <el-checkbox
                  v-model="checkedXB"
                  @change=" getItemNameCol('性别')"
                >性别</el-checkbox>
                <el-checkbox
                  v-model="checkedNL"
                  @change=" getItemNameCol('年龄')"
                >年龄</el-checkbox>
                <el-checkbox
                  v-model="checkedHY"
                  @change=" getItemNameCol('婚姻状况')"
                >婚姻状况</el-checkbox>
                <el-checkbox
                  v-model="checkedMZ"
                  @change=" getItemNameCol('民族')"
                >民族</el-checkbox>
              </div>
            </el-card>
            <el-card class="box-card cardItem">
              <div
                slot="header"
                class="clearfix"
              >
                <span style="color: #1d6cc3">地址：</span>
              </div>

              <div class="pucLabel">
                <el-checkbox
                  v-model="checkedJZD"
                  @change=" getItemNameCol('居住地')"
                >居住地</el-checkbox>
                <el-checkbox
                  v-model="checkedCSD"
                  @change=" getItemNameCol('出生地')"
                >出生地</el-checkbox>
              </div>
            </el-card>
            <el-card class="box-card cardItem">
              <div
                slot="header"
                class="clearfix"
              >
                <span style="color: #1d6cc3">联系方式：</span>
              </div>

              <div class="pucLabel">
                <el-checkbox
                  v-model="checkedDHH"
                  @change=" getItemNameCol('电话号码')"
                >电话号码</el-checkbox>
                <el-checkbox
                  v-model="checkedSJH"
                  @change=" getItemNameCol('手机号')"
                >手机号</el-checkbox>
                <el-checkbox
                  v-model="checkedDZYX"
                  @change=" getItemNameCol('电子邮箱')"
                >电子邮箱</el-checkbox>
              </div>
            </el-card>
            <el-card class="box-card cardItem">
              <div
                slot="header"
                class="clearfix"
              >
                <span style="color: #1d6cc3">卡类型：</span>
              </div>

              <div class="pucLabel">
                <el-checkbox
                  v-model="checkedSFZH"
                  @change=" getItemNameCol('居民身份证号码')"
                >居民身份证号码</el-checkbox>
                <el-checkbox
                  v-model="checkedJKKH"
                  @change=" getItemNameCol('居民健康卡号')"
                >居民健康卡号</el-checkbox>
                <el-checkbox
                  v-model="checkedYBH"
                  @change=" getItemNameCol('医保卡号')"
                >医保卡号</el-checkbox>
              </div>
            </el-card>
          </div>
        </el-card>
        <el-card
          class="box-card"
          v-if="false"
        >
          <div
            slot="header"
            class="clearfix"
          >
            <span>精准合并条件</span>

            <button
              style="float: right;"
              v-if="false"
              type="button"
              class="btn btn-primary"
              @click="addData()"
            >保存
            </button>
          </div>

          <div class="pucLabel">
            <el-card class="box-card cardItem">
              <div
                slot="header"
                class="clearfix"
              >
                <span style="color: #1d6cc3">基本信息：</span>
              </div>

              <div class="pucLabel">
                <el-checkbox v-model="checked">姓名</el-checkbox>
                <el-checkbox v-model="checked">性别</el-checkbox>
                <el-checkbox v-model="checked">年龄</el-checkbox>
                <el-checkbox v-model="checked">婚姻状况</el-checkbox>
                <el-checkbox v-model="checked">民族</el-checkbox>
              </div>
            </el-card>
          </div>
        </el-card>
        <el-card class="box-card">
          <div
            slot="header"
            class="clearfix"
          >
            <span>定时自动合并</span>

            <button
              style="float: right;"
              v-if="false"
              type="button"
              class="btn btn-primary"
              @click="addData()"
            >保存
            </button>
          </div>

          <div class="pucLabel">
            <el-card class="box-card cardItem">
              <div
                slot="header"
                class="clearfix"
              >
                <span style="color: #1d6cc3">基本信息：</span>
              </div>

              <div class="pucLabel">
                <p
                  class="selectTime"
                  style="margin: 2rem"
                >
                  <label>合并日期：</label>
                  <el-date-picker
                    style="width:98px;height:32px"
                    type="date"
                    v-model="setingObj.mergedate"
                    value-format="yyyy-MM-dd"
                    placeholder="选择日期"
                  >
                  </el-date-picker>
                </p>
                <p
                  class="selectTime"
                  style="margin: 2rem"
                >
                  <label>合并时间：</label>

                  <el-time-select
                    style="width:98px;height:32px"
                    v-model="setingObj.mergetime"
                    :picker-options="{
    start: '00:00',
    step: '00:15',
    end: '23:59'
  }"
                    placeholder="选择时间"
                  >
                  </el-time-select>

                </p>
                <p style="margin: 2rem">
                  <label>合并间隔：</label>
                  <input
                    type="text"
                    style="width:98px;height:32px"
                    v-model="setingObj.mergeinterval"
                    placeholder="必填"
                  >
                  </input>
                </p>
                <p style="margin: 2rem">
                  <label>是否生效：</label>

                  <el-radio
                    v-model="setingObj.effective"
                    label="1"
                  >是</el-radio>
                  <el-radio
                    v-model="setingObj.effective"
                    label="0"
                  >否</el-radio>
                </p>
              </div>
            </el-card>
            <el-row style="margin-top: 16px">
              <el-col :span="12">
                <el-link disabled></el-link>
              </el-col>
              <el-col :span="12">
                <div class="grid-content bg-purple-light div_P">
                  <el-button
                    type="success"
                    plain
                    @click="addSYTJData()"
                  >保存</el-button>
                </div>
              </el-col>

            </el-row>
          </div>
        </el-card>
      </div>

      <!--弹框增加用户-->
      <div
        class="blackBg hyCZBg"
        v-if="isShow=='addUserTJ'"
      >
        <div class="panel-default column2">
          <em
            class="closes"
            @click="showDialog('')"
          >×</em>
          <div class="panel-heading">添加用户</div>
          <div class="pucLabel">
            <div class="form-group clearfix">
              <p>
                <label>姓名：</label>
                <input
                  type="text"
                  class="form-control"
                  v-model="userObj.UserName"
                />
              </p>
              <p>
                <label>编号：</label>
                <input
                  type="text"
                  class="form-control"
                  v-model="userObj.UserNo"
                />
              </p>
            </div>
          </div>
          <div class="pucLabel">
            <div class="form-group clearfix">
              <p>
                <label>登录密码：</label>
                <input
                  type="text"
                  class="form-control"
                  v-model="userObj.UserPass"
                />
              </p>
              <p>
                <label>手机号：</label>
                <input
                  type="text"
                  class="form-control"
                  v-model="userObj.TelePhone"
                />
              </p>
            </div>
          </div>
          <div class="pucLabel">
            <div class="form-group clearfix">
              <p>
                <label>擅长：</label>
                <input
                  type="text"
                  class="form-control"
                  v-model="userObj.Title"
                />
              </p>
              <p>
                <label>简介：</label>
                <input
                  type="text"
                  class="form-control"
                  v-model="userObj.Describe"
                />
              </p>
            </div>
          </div>
          <div class="pucLabel">
            <div class="form-group clearfix">
              <p>
                <label>角色：</label>
                <select
                  class="form-control"
                  v-model="userObj.RoleId"
                  placeholder="请选择"
                >
                  <option
                    v-for="(item,index) in RoleList"
                    :label="item.RoleName"
                    :value="item.RoleId"
                    :key="index"
                  ></option>
                </select>
              </p>
            </div>
          </div>

          <div class="pucLabel">
            <div class="form-group clearfix">
              <p>
                <input
                  type="file"
                  id="id"
                  name="image"
                  class="getImgUrl_file"
                  @change="shangc($event)"
                  accept="image/jpg,image/jpeg,image/png"
                >
                <img
                  :src="userObj.UserPhoto2"
                  style="width: 120px;height: 120px"
                >
              </p>

            </div>
          </div>
          <div class="modal-footer">
            <button
              type="button"
              class="btn btn-default"
              @click="showDialog('')"
            >关闭</button>
            <button
              type="button"
              class="btn btn-primary"
              @click="addUserDataTJ()"
            >保存</button>
          </div>
        </div>
      </div>

    </div>
  </div>

</template>
<script>
export default {
  name: "Bedinformation",
  data () {
    return {
      msg: "SystemManagement 下的 Bedinformation",
      radioZJ: "",
      checkedXM: false,
      xmCol: "",
      checkedXB: false,
      xbCol: "",
      checkedNL: false,
      nlCol: "",
      checkedHY: false,
      hyCol: "",
      checkedMZ: false,
      mzCol: "",

      checkedJZD: false,
      jzdCol: "",
      checkedCSD: false,
      csdCol: "",

      checkedDHH: false,
      dhhCol: "",
      checkedSJH: false,
      sjhCol: "",
      checkedDZYX: false,
      dzyxCol: "",

      checkedSFZH: false,
      sfzhCol: "",
      checkedJKKH: false,
      jkkhCol: "",
      checkedYBH: false,
      ybhCol: "",

      //
      setingObj: {
        id: "-1",
        basemergecondition: "",//基本信息合并条件
        addressmergecondition: "",//地址信息合并条件
        contactmergecondition: "",//联系方式合并条件
        cardtypemergecondition: "",//卡类型信息合并条件
        createtime: "2020-01-01 12:01",//创建时间
        mergedate: "",//合并日期
        mergetime: "",//合并时间
        mergeinterval: "",//合并间隔
        effective: "0"//是否生效
      },


      isShow: "",
      Hospital: {
        HospitalId: -1,
        HospitalCode: "",
        HospitalName: "",
        HospitalImg: "",
        HospitalStatus: 0,
        Describe: "",
        AddUserId: -1,
        AddTime: "2020-01-13T07:02:42.448Z"
      },
      zzjgList: [],
      selectZZJG: null,
      DeptObj: {
        Id: 0,
        HospitalId: 0,
        DeptId: "",
        Name: "",
        PYM: "",
        Describe: "",
        AddUserId: 0,
        AddTime: "2020-01-13T08:24:49.026Z"
      },
      deptList: [],
      selectDept: null,
      userObj: {
        UserId: -1,
        HospitalId: -1,
        UserNo: "",
        UserName: "",
        UserPass: "",
        UserPhoto: "",
        UserPhoto2: "",
        UserStatus: 0,
        RoleId: 0,
        Title: "",
        Describe: "",
        TelePhone: "",
        AddTime: "2020-01-14T02:09:31.538Z",
        LastLoginTime: "2020-01-14T02:09:31.538Z",
        LastLoginDevice: ""
      },
      userList: [],
      isUpdateImge: false,
      imgUrl: "",
      RoleList: [],
      /*********************************************************************************************************/

    };
  },
  methods: {

    addSYTJData () {
      this.setingObj.basemergecondition = ""
      this.setingObj.addressmergecondition = ""
      this.setingObj.contactmergecondition = ""
      this.setingObj.cardtypemergecondition = ""
      if (this.checkedXM) {
        this.setingObj.basemergecondition += "|姓名^" + this.xmCol
      }
      if (this.checkedXB) {
        this.setingObj.basemergecondition += "|性别^" + this.xbCol
      }
      if (this.checkedNL) {
        this.setingObj.basemergecondition += "|年龄^" + this.nlCol
      }
      if (this.checkedHY) {
        this.setingObj.basemergecondition += "|婚姻^" + this.hyCol
      }
      if (this.checkedMZ) {
        this.setingObj.basemergecondition += "|民族^" + this.mzCol
      }
      if (this.checkedJZD) {
        this.setingObj.addressmergecondition += "|居住地^" + this.jzdCol
      }
      if (this.checkedCSD) {
        this.setingObj.addressmergecondition += "|出生地^" + this.csdCol
      }
      if (this.checkedDHH) {
        this.setingObj.contactmergecondition += "|电话号^" + this.dhhCol
      }
      if (this.checkedSJH) {
        this.setingObj.contactmergecondition += "|手机号^" + this.sjhCol
      }
      if (this.checkedDZYX) {
        this.setingObj.contactmergecondition += "|电子邮箱^" + this.dzyxCol
      }
      if (this.checkedSFZH) {
        this.setingObj.cardtypemergecondition += "|居民身份证号^" + this.sfzhCol
      }
      if (this.checkedJKKH) {
        this.setingObj.cardtypemergecondition += "|居民健康卡号^" + this.jkkhCol
      }
      if (this.checkedYBH) {
        this.setingObj.cardtypemergecondition += "|医保号^" + this.ybhCol
      }


      var data = this.setingObj
      console.log(data);
      //POST /v1/empioption/Create
      //POST /v1/empioption/Update
      var url = ""
      if (this.setingObj.id == -1) {
        console.log("执行新增")
        url = "empioption/Create"
      } else {
        console.log("执行修改")
        url = "empioption/Update"
      }
      this.$post(url, data)
        .then(res => {
          console.log(res);
          if (res.code == 0) {
            this.getSYTJData();
          } else {
            this.$message({
              showClose: true,
              message: res.msg,
              type: "error"
            });
          }
        })
        .catch(err => {
          console.log(err);
        });
    },
    getItemNameCol (name) {
      //GET /v1/empioption/{Name}
      var params = {}
      this.$get("empioption/name", params)
        .then(res => {

          console.log("字段代码查询结果");
          console.log(res);
          if (res.code != -1 && res.data != null) {

            if (name.toString().indexOf("姓名") != -1) {
              console.log("姓名");
              this.xmCol = res.data.Name;
            }
            if (name.toString().indexOf("性别") != -1) {
              console.log("性别");
              this.xbCol = res.data.Name;
            }
            if (name.toString().indexOf("年龄") != -1) {
              this.nlCol = res.data.Name;
            }
            if (name.toString().indexOf("婚姻") != -1) {
              this.hyCol = res.data.Name;
            }
            if (name.toString().indexOf("民族") != -1) {
              this.mzCol = res.data.Name;
            }
            if (name.toString().indexOf("居住地") != -1) {
              this.jzdCol = res.data.Name;
            }
            if (name.toString().indexOf("出生地") != -1) {
              this.csdCol = res.data.Name;
            }
            if (name.toString().indexOf("电话号") != -1) {
              this.dhhCol = res.data.Name;
            }
            if (name.toString().indexOf("手机号") != -1) {
              this.sjhCol = res.data.Name;
            }
            if (name.toString().indexOf("电子邮箱") != -1) {
              this.dzyxCol = res.data.Name;
            }
            if (name.toString().indexOf("居民身份证号") != -1) {
              this.sfzhCol = res.data.Name;
            }
            if (name.toString().indexOf("居民健康卡号") != -1) {
              this.jkkhCol = res.data.Name;
            }
            if (name.toString().indexOf("医保号") != -1) {
              this.ybhCol = res.data.Name;
            }

          }


        })
        .catch(err => {
          console.log(err);
        });
    },
    //GET /v1/empioption
    getSYTJData () {
      var params = {
        name: ""
      };
      this.$get("empioption", params)
        .then(res => {

          console.log("合并条件设置列表查询结果");
          console.log(res);
          if (res.code != -1 && res.data != null && res.data.length > 0) {
            this.setingObj = res.data[0];
            if (this.setingObj.basemergecondition.toString().indexOf("姓名") != -1) {
              this.checkedXM = true
            }
            if (this.setingObj.basemergecondition.toString().indexOf("性别") != -1) {
              this.checkedXB = true
            }
            if (this.setingObj.basemergecondition.toString().indexOf("年龄") != -1) {
              this.checkedNL = true
            }
            if (this.setingObj.basemergecondition.toString().indexOf("婚姻") != -1) {
              this.checkedHY = true
            }
            if (this.setingObj.basemergecondition.toString().indexOf("民族") != -1) {
              this.checkedMZ = true
            }
            if (this.setingObj.addressmergecondition.toString().indexOf("居住地") != -1) {
              this.checkedJZD = true
            }
            if (this.setingObj.addressmergecondition.toString().indexOf("出生地") != -1) {
              this.checkedCSD = true
            }
            if (this.setingObj.contactmergecondition.toString().indexOf("电话号") != -1) {
              this.checkedDHH = true
            }
            if (this.setingObj.contactmergecondition.toString().indexOf("手机号") != -1) {
              this.checkedSJH = true
            }
            if (this.setingObj.contactmergecondition.toString().indexOf("电子邮箱") != -1) {
              this.checkedDZYX = true
            }
            if (this.setingObj.cardtypemergecondition.toString().indexOf("居民身份证号") != -1) {
              this.checkedSFZH = true
            }
            if (this.setingObj.cardtypemergecondition.toString().indexOf("居民健康卡号") != -1) {
              this.checkedJKKH = true
            }
            if (this.setingObj.cardtypemergecondition.toString().indexOf("医保号") != -1) {
              this.checkedYBH = true
            }
            this.setingObj.effective = this.setingObj.effective.toString()
          }


        })
        .catch(err => {
          console.log(err);
        });
    },


    showDialog (isShow) {
      this.isShow = isShow;
      this.isUpdateImge = false
      if (isShow == '') {
        this.getUserList();
      }
    },
    updateRow (index, rows) {
      console.log("更新条目");
      console.log(rows[index]);
      this.userObj = rows[index];
      this.userObj.imgUrl = this.$getBaseIP() + this.userObj.UserPhoto;
      console.log(this.userObj.imgUrl);
      this.showDialog('updateUserTJ')
    },
    deleteRow (index, rows) {
      console.log("删除条目");
      console.log(rows[index]);
      this.deleteUserDataTJ(rows[index].UserId)
    },
    addUserDataTJ () {
      //sf1007000107298
      if (this.selectZZJG == null) {
        this.$message({
          showClose: true,
          message: "请选择操作机构！",
          type: "error"
        });
        return;
      }

      this.userObj.HospitalId = this.selectZZJG.HospitalId;

      var data = this.userObj
      console.log(data);
      this.$post("User/Create", data)
        .then(res => {
          console.log(res);
          if (res.code == 0) {
            this.userObj.UserId = -1;
            this.userObj.HospitalId = -1;
            this.userObj.UserNo = "";
            this.userObj.UserName = "";
            this.userObj.UserPass = "";
            this.userObj.UserPhoto = "";
            this.userObj.UserPhoto2 = "";
            this.userObj.UserStatus = 0;
            this.userObj.RoleId = 0;
            this.userObj.Title = "";
            this.userObj.Describe = "";
            this.userObj.TelePhone = "";
            this.userObj.AddTime = "2020-01-14T02:09:31.538Z";
            this.userObj.LastLoginTime = "2020-01-14T02:09:31.538Z";
            this.userObj.LastLoginDevice = ""
            this.showDialog("");
            this.getZZJGList();
          } else {
            this.$message({
              showClose: true,
              message: res.msg,
              type: "error"
            });
          }
        })
        .catch(err => {
          console.log(err);
        });
    },
    updateUserDataTJ () {
      if (this.selectZZJG == null) {
        this.$message({
          showClose: true,
          message: "请选择操作机构！",
          type: "error"
        });
        return;
      }
      console.log(this.selectZZJG);
      this.userObj.HospitalId = this.selectZZJG.HospitalId;
      var data = this.userObj;
      console.log(data);
      this.$post("User/Update", data)
        .then(res => {
          console.log(res);
          if (res.code == 0) {
            this.userObj.HospitalId = -1;
            this.userObj.UserNo = "";
            this.userObj.UserName = "";
            this.userObj.UserPass = "";
            this.userObj.UserPhoto = "";
            this.userObj.UserPhoto2 = "";
            this.userObj.UserStatus = 0;
            this.userObj.RoleId = 0;
            this.userObj.Title = "";
            this.userObj.Describe = "";
            this.userObj.TelePhone = "";
            this.userObj.AddTime = "2020-01-14T02:09:31.538Z";
            this.userObj.LastLoginTime = "2020-01-14T02:09:31.538Z";
            this.userObj.LastLoginDevice = ""
            this.showDialog("");
            this.getUserList();
          } else {
            this.$message({
              showClose: true,
              message: res.msg,
              type: "error"
            });
          }

        })
        .catch(err => {
          console.log(err);
        });
    },
    deleteUserDataTJ (Id) {
      var data = {
        UserId: Id
      }
      console.log(data);
      this.$post("User/Delete", data)
        .then(res => {
          console.log(res);
          if (res.code == 0) {
            this.getUserList();
          } else {
            this.$message({
              showClose: true,
              message: res.msg,
              type: "error"
            });
          }
        })
        .catch(err => {
          console.log(err);
        });
    },
    getUserList () {
      this.userList = [];

      this.userObj.UserId = -1;
      this.userObj.HospitalId = -1;
      this.userObj.UserNo = "";
      this.userObj.UserName = "";
      this.userObj.UserPass = "";
      this.userObj.UserPhoto = "";
      this.userObj.UserPhoto2 = "";
      this.userObj.UserStatus = 0;
      this.userObj.RoleId = 0;
      this.userObj.Title = "";
      this.userObj.Describe = "";
      this.userObj.TelePhone = "";
      this.userObj.AddTime = "2020-01-14T02:09:31.538Z";
      this.userObj.LastLoginTime = "2020-01-14T02:09:31.538Z";
      this.userObj.LastLoginDevice = ""


      if (this.selectZZJG == null) {
        this.$message({
          showClose: true,
          message: "请选择操作机构！",
          type: "error"
        });
        return;
      }
      var params = {
        HospitalId: this.selectZZJG.HospitalId,
        name: ""
      };
      this.$get("User/GetList", params)
        .then(res => {
          this.userList = res.data;
          console.log("用户列表查询结果");
          console.log(res);
        })
        .catch(err => {
          console.log(err);
        });
    },
    getDeptList () {
      this.deptList = [];
      this.DeptObj.Id = -1;
      this.DeptObj.HospitalId = -1;
      this.DeptObj.DeptId = "";
      this.DeptObj.Name = "";
      this.DeptObj.PYM = "";
      this.DeptObj.Describe = "";
      this.DeptObj.AddUserId = -1;
      this.DeptObj.AddTime = "2020-01-13T08:24:49.026Z"
      if (this.selectZZJG == null) {
        this.$message({
          showClose: true,
          message: "请选择操作机构！",
          type: "error"
        });
        return;
      }
      var params = {
        HospitalId: this.selectZZJG.HospitalId,
        name: ""
      };
      this.$get("Dept/GetList", params)
        .then(res => {
          this.deptList = res.data;
          console.log("科室列表查询结果");
          console.log(res);
        })
        .catch(err => {
          console.log(err);
        });
    },
    getZZJGList () {
      this.zzjgList = [];

      var params = {
        name: ""
      };
      this.$get("Hospital/GetList", params)
        .then(res => {
          //this.total = res.data.totalCount;
          this.zzjgList = res.data;
          if (this.zzjgList.length > 0) {
            this.selectZZJG = this.zzjgList[0];
            this.getDeptList();
            this.getUserList();
          }
          console.log("组织机构列表查询结果");
          console.log(res);
        })
        .catch(err => {
          console.log(err);
        });
    },
    //角色列表查询
    queryRole () {
      this.RoleList = [];
      var params = {};
      //GET /api/Role/GetList
      this.$get("Role/GetList", params)
        .then(res => {
          console.log("角色列表查询结果");
          console.log(res);
          if (res.code == 0) {
            this.RoleList = res.data;
            console.log("角色列表");
            console.log(this.RoleList);
          }
        })
        .catch(err => {
          console.log(err);
        });
    },
    //图像转换Base64
    shangc (e) {
      let files = document.getElementById('id').files[0]
      let name = document.getElementById('id').files[0].name
      let arr = name.split('.')
      console.log(arr);
      let fileSize = 0;
      let fileMaxSize = 10240;//1M
      if (files) {
        fileSize = files.size;
        if (fileSize > 2 * 1024 * 1024) {
          alert("文件大小不能大于2M！");
          file.value = "";
          return false;
        } else if (fileSize <= 0) {
          alert("文件大小不能为0M！");
          file.value = "";
          return false;
        }
      } else {
        return false;
      }

      //转码base64
      let reader = new FileReader();
      let imgFile
      // let that = this
      reader.readAsDataURL(files)
      reader.onload = e => {
        imgFile = e.target.result;
        let arr = imgFile.split(',')
        this.userObj.UserPhoto = arr[1]
        this.userObj.UserPhoto2 = imgFile;
        console.log(this.userObj.UserPhoto)
        // console.log(this.userObj.UserPhoto)
      }

    },
    shangcUpdate (e) {

      let files = document.getElementById('id2').files[0]
      let name = document.getElementById('id2').files[0].name
      let arr = name.split('.')
      console.log(arr);
      let fileSize = 0;
      let fileMaxSize = 10240;//1M
      if (files) {
        fileSize = files.size;
        if (fileSize > 2 * 1024 * 1024) {
          alert("文件大小不能大于2M！");
          file.value = "";
          return false;
        } else if (fileSize <= 0) {
          alert("文件大小不能为0M！");
          file.value = "";
          return false;
        }
      } else {
        return false;
      }

      //转码base64
      let reader = new FileReader();
      let imgFile
      // let that = this
      reader.readAsDataURL(files)
      reader.onload = e => {
        imgFile = e.target.result;
        let arr = imgFile.split(',')
        this.userObj.UserPhoto = arr[1]
        this.userObj.UserPhoto2 = imgFile;
        console.log(this.userObj.UserPhoto2)
        this.isUpdateImge = true;
        // console.log(this.userObj.UserPhoto)
      }

    },
  }, //
  created () {
    if (this.$route.query.Token) {
      localStorage.setItem('Token', this.$route.query.Token)
    }
    this.getSYTJData();
  }
};
</script>
<style lang="scss">
.UserInformationZSYPZ {
  .cardPD {
    .text {
      font-size: 12px;
    }

    .el-card__header {
      padding: 8px 20px;
      border-bottom: 1px solid #ebeef5;
      -webkit-box-sizing: border-box;
      box-sizing: border-box;
      background-color: azure;
    }

    .item {
      margin-bottom: 18px;
    }

    .clearfix:before,
    .clearfix:after {
      display: table;
      content: "";
    }

    .clearfix:after {
      clear: both;
    }

    .box-card {
      width: 100%;
    }
  }

  .selectTime {
    .el-input__icon {
      height: 100%;
      width: 25px;
      display: none;
      text-align: center;
      -webkit-transition: all 0.3s;
      transition: all 0.3s;
      line-height: 40px;
    }

    .input {
      width: 90px !important;
      height: 28px !important;
    }
  }

  .cardItem {
    .text {
      font-size: 12px;
    }

    .el-card__header {
      padding: 8px 20px;
      border-bottom: 1px solid #ebeef5;
      -webkit-box-sizing: border-box;
      box-sizing: border-box;
      background-color: white;
    }

    .item {
      margin-bottom: 18px;
    }

    .clearfix:before,
    .clearfix:after {
      display: table;
      content: "";
    }

    .clearfix:after {
      clear: both;
    }

    .box-card {
      width: 100%;
    }
  }

  .keQu .mContent {
    clear: both;
  }

  .keQu .form-group {
    height: 45px;
    padding: 6px 5px 0 10px !important;
  }

  .keQu .mContent .ltList {
    border-right: 1px solid #ddd;
    width: 380px;
    position: absolute;
    top: 90px;
    left: 0;
    bottom: 0;
  }

  .keQu .mContent .ltList .p1 + div {
    overflow-y: auto;
    position: absolute;
    left: 0;
    right: 0;
    top: 28px;
    bottom: 0;
  }

  .keQu .mContent .rtList {
    position: absolute;
    top: 90px;
    left: 380px;
    bottom: 0;
    overflow-y: auto;
    right: 0;
  }

  .keQu .mContent .rtList .table {
    width: 600px;
  }

  .keQu .mContent .p1 + div {
    padding: 8px 10px;
  }

  .el-tree-node.is-current > .el-tree-node__content {
    color: #fff;
    background: #155a00 !important;

    .el-button span {
      color: #fff;
    }
  }

  .custom-tree-node {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 14px;
    padding-right: 8px;
  }

  .el-table {
    font-size: 14px !important;
  }

  .el-table thead {
    color: #303133;
  }
}
</style>
